package action;


import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import po.EmailDAO;

import bean.EmailBean;

import com.opensymphony.xwork2.ActionSupport;

public class EmailSended extends ActionSupport{
	private List list;
	private int page=1;
	private int allpage;
	private int pages;


	public String execute(){
		HttpServletRequest request = ServletActionContext.getRequest();
		List list = new EmailBean().selectSendedAll((String)request.getSession().getAttribute("name"));
		pages = list.size(); //总记录数
		
		allpage = (pages+5-1)/5; //分页总页数
		
		List lists = new EmailBean().selectSended(page-1,(String)request.getSession().getAttribute("name"));

		setAllpage(allpage);
		setPages(pages);	
		setList(lists);
		return "sended";	
	}

	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getAllpage() {
		return allpage;
	}

	public void setAllpage(int allpage) {
		this.allpage = allpage;
	}

	public int getPages() {
		return pages;
	}

	public void setPages(int pages) {
		this.pages = pages;
	}
	
}
